{if $full_page}
<!--头部 -->
{include file="common/admin_header.html"}
<!--头部 -->
<!--顶部导航 -->
{include file="common/top_nav.html"}
<!--顶部导航 -->

<!--左侧导航 -->
{include file="common/left_nav.html"}
<!--左侧导航 -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box box-success">
                        <div class="box-header">
                            <h3 class="box-title">文章列表</h3>
                        </div>
                        <form action="" method="post" enctype="multipart/form-data" class="form-inline definewidth pad-10" >
                            <strong class="fs-14">搜索：</strong>
                            <input type="text" name="keywords" value="{$search}" class="keywords input-default form-control" placeholder="名称">&nbsp;&nbsp;
                            <select class="form-control cateid" name="catname" id="catname">
                                <!--显示栏目-->
                                <option value="0">所有分类</option>
                                {foreach from=$catname item=cat_info}
                                <option  style="margin-left:{$cat_info.level}em" value='{$cat_info.cat_id}'>{$cat_info.html}{$cat_info.cat_name}</option>
                                {/foreach}
                            </select>
                            <button type="submit" class="btn btn-primary" c="{$c}">查询</button>
                            <a href="?c={$c}&a=add" title="添加"><span class="btn btn-primary btn-danger">添加</span></a>
                        </form>
                        <!-- 数据的显示 -->
                        <div class="box-body" id="data-list">
                         <!--非ajax返回 -->
                        {/if}
                        <!--ajax返回数据 -->
                        <table  class="table table-bordered table-striped text-center" >
                            <thead>
                            <tr>
                                <th>编号 </th>
                                <th>文章标题 </th>
                                <th>文章分类 </th>
                                <th>文章的重要性 </th>
                                <th>是否显示 </th>
                                <th>添加日期 </th>
                                <th>操作</th>
                                <tr>
                            </thead>
                            <tbody>
                            {foreach from=$lists item=list}
                            <tr>
                                <td>{$list.article_id}</td>
                                <td>{$list.title}</td>
                                <td>{$list.cat_name}</td>
                                <td>{ if $list.article_type eq 0}普通{else}置顶{/if}</td>
                                <td style="width:120px;">{if $list.is_open eq 1}<img onclick="img(this,'{$list.is_open}','{$list.article_id}')" src="/manage/views/images/yes.gif"/> {else} <img onclick="img(this,'{$list.is_open}','{$list.article_id}')" src="/manage/views/images/no.gif"/> {/if}</td>
                                <td>{$list.add_time}</td>
                                    <td>
                                        <!--查看功能-->
                                        <!--<a href="?c={$c}&a=show&id={$list.brand_id}" title="查看"> <span class="label label-warning" style="font-size: 100%;"><span class="glyphicon glyphicon-search" style="top: 3px;margin-right: 3px;"></span>查看</span></a>-->
                                        <a href="?c={$c}&a=edit&article_id={$list.article_id}" title="编辑"> <span class="label label-success" style="font-size: 100%;"><span class="glyphicon glyphicon-pencil" style="top: 3px;margin-right: 3px;"></span> 编辑</span></a>
                                        <a title="删除" href="javascript:void(0)">
                                            <span class="label label-danger" style="font-size: 100%;" onclick="action.confirm({$list.article_id})"><span class="glyphicon glyphicon-trash" style="top: 3px;margin-right: 3px;"></span>删除</span>
                                        </a>
                                    </td>
                                </tr>
                                {foreachelse}
                                <tr>
                                    <td class="no-records" colspan="11">
                                        <span class="ion ion-ios-gear-outline" style="font-size: 50px;"><i class="ion ion-ios-gear-outline"></i></span>
                                        <h3>没有数据</h3>
                                        <h5>由<a href="/">{$config.shop_name}</a>提供技术支持</h5>
                                    </td>
                                </tr>
                                {/foreach}

                            </tbody>
                        </table>
                             <!-- 分页数据  -->
                            {include file="common/admin_page.html"}
                               <!-- 数据显示结束  -->
                            {if $full_page}
                            <!--非ajax返回 -->
                        </div>
                    </div>

                </div>

            </div>

        </section>
    </div>
<!--移除表单-->
<div class="modal fade" id="confirm" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true" style="">
    <div class="modal-dialog" style="margin-top: 220px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title">
                    确认操作
                </h4>
            </div>
            <form class="form-horizontal" action="">
                <div class="modal-body  text-center">

                    <p class="fs-14 co-999">确认删除吗?</p>

                </div>
                <div class="modal-footer text-center">
                    <button type="button" class="btn btn-primary btn-danger" onclick="destroy()" data-loading-text="提交中..."  data-complete-text="重新发送">确定</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                </div>
            </form>
        </div>
    </div>
</div>
<!--移除表单-->
{include file="common/admin_footer.html"}
<script>
    $(function(){
        $(":submit").click(function(){
            action.param.keywords=$(".keywords").val();
            action.param.cateid=$(".cateid").val();
            action.param.page=1;
            action.search(this);
            return false;
        });
    });
    /*移除*/
    function destroy(){
        var id=$("#confirm").attr("action");
        $.post('?c={$c}&a=destroy',{'id':id},function(data) {
            if(data.code<1){
                alert("操作失败");
            }
            window.location.reload();
        });
    }
    /**
     * @param a this 当前
     * @param param status  状态
     * @param id  id
     */
    function img(a,param,id){
        $.post('?c={$c}&a=is_open',{'article_id':id,'is_open':param},function(data) {
//            alert(JSON.stringify(data));

            if(data.code<1){
                alert("操作失败");
            }else{
                if($(a).attr('src') == "images/no.gif"){
                    $(a).attr('src',"images/yes.gif");
                }else{
                    $(a).attr('src',"images/no.gif");
                }
            }
        });
    }
</script>
{/if}
